/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author ...
* @date 2020-11-08
**/
@Entity
@Data
@Table(name="shuyi_borrow_list")
public class BorrowList implements Serializable {

    private static final long serialVersionUID = 4035926459128447675L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "borrow_list_id")
    @ApiModelProperty(value = "借书编号,自增长 ")
    private Integer borrowListId;

    @Column(name = "real_book_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "真实图书编号 ")
    private Integer realBookId;

    @Column(name = "borrow_time",nullable = false)
    @NotNull
    @ApiModelProperty(value = "借书时间 ")
    private Timestamp borrowTime;

    @Column(name = "is_returned")
    @ApiModelProperty(value = "0:未还 1:已还 ")
    private Boolean isReturned;

    @Column(name = "sure_return")
    @ApiModelProperty(value = "读者点击确定要还书 0:未点击 1:已点击 ")
    private Boolean sureReturn;

    @Column(name = "reader_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "读者编号 ")
    private Integer readerId;

    @Column(name = "needreturn_time",nullable = false)
    @NotNull
    @ApiModelProperty(value = "需要规归还的时间")
    private Timestamp needreturnTime;

    @Column(name = "type")
    @ApiModelProperty(value = "可以续借0 不可以续借1 ")
    private Integer type;

    @Column(name = "return_library_mode")
    @ApiModelProperty(value = "借书方式:0自提 1:快递 2:面对面 ")
    private Integer returnLibraryMode;

    @Column(name = "is_enable",nullable = false)
    @NotNull
    @ApiModelProperty(value = "是否启用 1启用 0未启用")
    private Boolean isEnable;

    public void copy(BorrowList source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}